package com.ruoyi.server.api.share.service.impl;

import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.server.api.share.mapper.ShareMapper;
import com.ruoyi.server.api.share.domain.Share;
import com.ruoyi.server.api.share.service.IShareService;

/**
 * 分享上传Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-29
 */
@Service
public class ShareServiceImpl implements IShareService
{
    @Autowired
    private ShareMapper shareMapper;

    /**
     * 查询分享上传
     *
     * @param id 分享上传主键
     * @return 分享上传
     */
    @Override
    public Share selectShareById(Long id)
    {
        return shareMapper.selectShareById(id);
    }

    /**
     * 查询分享上传列表
     *
     * @param share 分享上传
     * @return 分享上传
     */
    @Override
    public List<Share> selectShareList(Share share)
    {
        return shareMapper.selectShareList(share);
    }

    /**
     * 新增分享上传
     *
     * @param share 分享上传
     * @return 结果
     */
    @Override
    public int insertShare(Share share)
    {
        share.setCreateTime(new Date());
        share.setUpdateTime(new Date());
        return shareMapper.insertShare(share);
    }

    /**
     * 修改分享上传
     *
     * @param share 分享上传
     * @return 结果
     */
    @Override
    public int updateShare(Share share)
    {
        share.setUpdateTime(new Date());
        return shareMapper.updateShare(share);
    }

    /**
     * 批量删除分享上传
     *
     * @param ids 需要删除的分享上传主键
     * @return 结果
     */
    @Override
    public int deleteShareByIds(Long[] ids)
    {
        return shareMapper.deleteShareByIds(ids);
    }

    /**
     * 删除分享上传信息
     *
     * @param id 分享上传主键
     * @return 结果
     */
    @Override
    public int deleteShareById(Long id)
    {
        return shareMapper.deleteShareById(id);
    }

    /**
    * @Author zsc
    * @Description 查询所有分享
    * @Date 2024/11/14 9:19
    * @Return java.util.List<com.ruoyi.server.api.share.domain.Share>

    */
    @Override
    public List<Share> selectShareLists() {
        return shareMapper.selectShareLists();
    }

    /**
    * @Author zsc
    * @Description 查询单用户分享
    * @Date 2024/11/14 9:19
    * @Return java.util.List<com.ruoyi.server.api.share.domain.Share>
    * @param userId
    */
    @Override
    public List<Share> selectListById(BigInteger userId) {
        return shareMapper.selectListById(userId);
    }


}